package datastructure.array;

import java.util.ArrayList;
import java.util.List;

/**
 * @author XY
 * @version 1.0
 * @date 2022/3/4 9:34
 * @Description
 */
public class Leet119 {

    public static List<Integer> generate(int rowIndex) {
        List<Integer> list = new ArrayList<>();
        for (int i = 0; i <= rowIndex; i++) {
            List<Integer> temp = new ArrayList<>();
            for (int j = 0; j <= i; j++) {
                if(j==0||j==i){
                    temp.add(1);
                }else{
                    temp.add(list.get(j)+list.get(j-1));
                }
            }
            list = temp;
        }
        return list;
    }


}
